import request from '@/config/axios'

/** 服务分类信息 */
export interface ServiceClass {
          id: number; // ID
          name?: string; // 分类名称
          icon?: string; // 分类图标
          parentId?: number; // 父级分类ID
          sort: number; // 排序
          homeRecommend?: boolean; // 首页推荐（0否 1是）
  }

// 服务分类 API
export const ServiceClassApi = {
  // 查询服务分类分页
  getServiceClassPage: async (params: any) => {
    return await request.get({ url: `/business/service-class/page`, params })
  },

  // 查询服务分类详情
  getServiceClass: async (id: number) => {
    return await request.get({ url: `/business/service-class/get?id=` + id })
  },

  // 查询服务分类详情
  getServiceClassAll: async () => {
    return await request.get({ url: `/business/service-class/all` })
  },

  // 新增服务分类
  createServiceClass: async (data: ServiceClass) => {
    return await request.post({ url: `/business/service-class/create`, data })
  },

  // 修改服务分类
  updateServiceClass: async (data: ServiceClass) => {
    return await request.put({ url: `/business/service-class/update`, data })
  },

  // 修改服务分类
  updateServiceClassStatus: async (data: ServiceClass) => {
    return await request.put({ url: `/business/service-class/update/status`, data })
  },

  // 删除服务分类
  deleteServiceClass: async (id: number) => {
    return await request.delete({ url: `/business/service-class/delete?id=` + id })
  },

  /** 批量删除服务分类 */
  deleteServiceClassList: async (ids: number[]) => {
    return await request.delete({ url: `/business/service-class/delete-list?ids=${ids.join(',')}` })
  },

  // 导出服务分类 Excel
  exportServiceClass: async (params) => {
    return await request.download({ url: `/business/service-class/export-excel`, params })
  },
}
